package src.java.Test;

import java.util.HashMap;

public class Solution {
    private static ThreadLocal<Integer> local1 = new ThreadLocal<>();
    private static ThreadLocal<Integer> local2 = new ThreadLocal<>();
//
//    public static int lengthOfLongestSubstring(String s) {
//        int left = 0, right = 0, maxLength = 0;
//        HashMap<Character, Integer> map = new HashMap<>();
//        while (right < s.length()) {
//            Integer index = map.getOrDefault(s.charAt(right), -1);
//            if (index != -1 && index >= left) {
//                left = map.get(s.charAt(right)) + 1;
//            }
//            map.put(s.charAt(right), right);
//            maxLength = Math.max(maxLength, right - left + 1);
//            right++;
//        }
//        return maxLength;
//    }
//
////    public static ListNode reverseList(ListNode head) {
////        if (head == null || head.next == null) return head;
////        ListNode newHead = reverseList(head.next);
////        head.next.next = head;
////        head.next = null;
////        return newHead;
////    }
//
//    public static ListNode reverseList(ListNode head) {
//        ListNode prev = null;
//        ListNode curr = head;
//        while (curr != null) {
//            ListNode next = curr.next;
//            curr.next = prev;
//            prev = curr;
//            curr = next;
//        }
//        return prev;
//    }

    public static void main(String[] args) {
        System.out.println(fun());
        HashMap<String, String> map = new HashMap<>();
        map.put("a", "b");
    }

    static int fun() {
        try {
            int a = 1 / 0;
            return 1;
        } catch (Exception e) {
            return 2;
        } finally {
            return 3;
        }
    }

    class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

}
